﻿@namespace MudBlazor
@inherits MudComponentBase
@typeparam T

<TemplateColumn T="T" Tag="@("hierarchy-column")" Sortable="false" Resizable="false" ShowColumnOptions="false" HeaderStyle="width:0%"
    Hideable="Hideable" Hidden="Hidden" HiddenChanged="HiddenChanged"
    Filterable="false" Editable="false" DragAndDropEnabled="@DragAndDropEnabled">
    <CellTemplate>
        @if (!_finishedInitialExpanded && InitiallyExpandedFunc.Invoke(context.Item))
        {
            _initiallyExpandedItems.Add(context);
        }
        <MudIconButton 
            Class="ma-n3 pa-1"
            Icon="@(context.OpenHierarchies.Contains(context.Item) ?  OpenIcon : ClosedIcon)" 
            OnClick="context.Actions.ToggleHierarchyVisibilityForItemAsync"
            Size="@IconSize"
            Disabled="ButtonDisabledFunc.Invoke(context.Item)"/>
    </CellTemplate>
</TemplateColumn>
